<?php
/**
* Admin GMaps Controller
*
* This handles all AJAX requests from the Admin GUI GMaps Configuration page.
* These methods will create an AJAX response containing JSON data. The JSON
* data is read by the JS code and rendered into interface.
*
* @access 	public
* @author 	Rob
* @copyright	ResMania 2009 all rights reserved.
* @version	1.0
* @link		http://developer.resmania.com/api
* @since  	05-2009
*/
class RM_Admin_UserGMapsController extends RM_Controller
{
    public function getmapAction(){

        // get the User address details
        $id = $this->_getParam('id');
        $dao = new RM_Users;
        $users = $dao->get($id)->toArray();

        if (!empty($users['address1'])) $address = $users['address1'];
        if (!empty($users['address2'])) $address .= ",".$users['address2'];
        if (!empty($users['city'])) $address .= ",".$users['city'];
        if (!empty($users['postcode'])) $address .= ",".$users['postcode'];
        //if (!empty($users['state'])) $address .= ",".$users['state'];
        if (!empty($users['country'])) $address .= ",".$users['country'];

        $this->view->address = $address;
        echo $this->view->render('UserGMaps/map.phtml');
        die();

    }
}